package com.yeban.javase.day14.test2;

import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;

import java.io.*;
import java.util.Scanner;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/24
 */
public class test002 {

    public static void main(String[] args) {

        File file = new File("src\\com\\yeban\\javase\\day14\\test2\\emp.txt");
        Scanner sc = new Scanner(System.in);
        System.out.print("请输入用户：");
        String username = sc.nextLine();
        System.out.print("请输入密码：");
        String paaaword = sc.nextLine();
        try(
                BufferedReader br = new BufferedReader(new FileReader(file));
        ) {
            String line = null;
            boolean flag = false;
            while((line = br.readLine()) != null) {
                String[] strs = line.split("#");
                if(strs[0].equals(username) && strs[1].equals(paaaword)) {
                    System.out.println("登录成功！");
                    flag = true;
                }
            }
            if(!flag) {
                System.out.println("登录失败！");
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
